package com.utilities.regex;

import java.util.StringTokenizer;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;

public class HttpCookie {

    public static void parseCookie(String header) {

        StringTokenizer tokenizer = new StringTokenizer(";");

        String nameValuePair;
        String name, value;
        while (tokenizer.hasMoreElements()) {
            nameValuePair = tokenizer.nextToken();
            int index = nameValuePair.indexOf('=');
            if (index > -1) {
                name = nameValuePair.substring(0, index).trim();
                value = nameValuePair.substring(index + 1).trim();
            } else {
                name = nameValuePair.trim();
                value = "";
            }
            System.out.println(name + "|" + value);
        }
    }

    public static void main(String[] args) {

        Supplier<String> supplier;

        Predicate<String> predicate;

        Consumer<String> consumer;


    }
}
